package com.blue.Impl.author;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blue.po.author.UserPostPO;
import com.blue.service.author.IUserPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.blue.mapper.author.PostMapper;
import com.blue.po.author.PostPO;
import com.blue.service.author.IPostService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, PostPO> implements IPostService {

    @Autowired
    private IUserPostService userPostService;

    @Override
    @Transactional
    public void delete(List<String> ids) {
        this.removeByIds(ids);
        userPostService.remove(new LambdaQueryWrapper<UserPostPO>()
                .in(UserPostPO::getPostId, ids));
    }
}
